package cn.livingCloud.dto;

import cn.livingCloud.entity.core.CaseCategory;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 唐旭 on 2016/6/2.
 */
public class CaseCategoryDto {
    private String uuid;
    private String name;
    private CaseCategoryDto parent;
    private List<CaseCategoryDto> subList = new ArrayList<>();
    private String shortName;

    public CaseCategoryDto() {
    }

    public CaseCategoryDto(CaseCategory category) {
        if (category == null) {
            return;
        }
        this.uuid = category.getUuid();
        this.name = category.getName();
        this.parent = new CaseCategoryDto(category.getParent());
        if (name.length() > 10) {
            this.shortName = name.substring(0, 9) + "...";
        } else {
            this.shortName = name;
        }
    }

    public String getName() {
        return name;
    }

    public CaseCategoryDto setName(String name) {
        this.name = name;
        return this;
    }

    public String getUuid() {
        return uuid;
    }

    public CaseCategoryDto setUuid(String uuid) {
        this.uuid = uuid;
        return this;
    }

    public CaseCategoryDto getParent() {
        return parent;
    }

    public CaseCategoryDto setParent(CaseCategoryDto parent) {
        this.parent = parent;
        return this;
    }

    public List<CaseCategoryDto> getSubList() {
        return subList;
    }

    public CaseCategoryDto setSubList(List<CaseCategoryDto> subList) {
        this.subList = subList;
        return this;
    }

    public String getShortName() {
        return shortName;
    }

    public CaseCategoryDto setShortName(String shortName) {
        this.shortName = shortName;
        return this;
    }
}
